﻿<controls:ChildWindow x:Class="Microsoft.OpenTurf.Silverlight.LoginPrompt"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
            xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           Width="{Binding Width}" Height="{Binding Height}" 
           Title="{Binding PromptTitle}">

    <controls:ChildWindow.DataContext>
        <Binding Path="Login" Mode="OneWay" Source="{StaticResource Locator}"/>
    </controls:ChildWindow.DataContext>

    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <StackPanel>
            <TextBlock Text="{Binding PromptText}" TextWrapping="Wrap"/>
            <ItemsControl ItemsSource="{Binding OAuthLinks}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <HyperlinkButton Content="{Binding Value}" NavigateUri="{Binding Key}"/>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </StackPanel>
        <Button x:Name="CancelButton" Content="{Binding CancelText}" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <cmd:EventToCommand Command="{Binding CancelClick}" PassEventArgsToCommand="True" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>
        <Button x:Name="OKButton" Content="{Binding OkText}" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <cmd:EventToCommand Command="{Binding LoginClick}" PassEventArgsToCommand="True" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>
    </Grid>
</controls:ChildWindow>